#include <iostream>
#include <thread>

void hello() 
{
    std::cout << "hello world\n";
}

// 函数返回thread
std::thread f() {
    void some_function();
    return std::thread(some_function);
}
// thread作为参数传递
void f2(std::thread t);
void g() {
    void some_function();
    f2(std::thread(some_function));
    std::thread t(some_function);
    f2(std::move(t)); // 资源转移
}

int main(int argc, char const *argv[])
{
    std::thread t(hello);
    t.join();
    
    return 0;
}
